﻿<html DIR="LTR" xmlns:tool="http://www.microsoft.com/tooltip" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:ddue="http://ddue.schemas.microsoft.com/authoring/2003/5" xmlns:MSHelp="http://msdn.microsoft.com/mshelp">
  <head>
    <META HTTP-EQUIV="Content-Type" CONTENT="text/html; CHARSET=utf-8" />
    <META NAME="save" CONTENT="history" />
    <title>Using Statements with the JDBC Driver</title>
    
    <link rel="stylesheet" type="text/css" href="../local/Classic.css">
      
    </link>
    
    <script src="../local/script.js">
      
    </script><script src="../local/script_main.js">&amp;nbsp;</script>
  </head>
  <body>
    <!--Topic built:03/05/2009 21:01:45-->

    
    
    
    
    
    
    
    
    
    <div id="header">
      <table width="100%" id="topTable"><tr>
          <td align="left">
            <span id="headerBold">Using Statements with the JDBC Driver</span>
          </td>
          <td align="right">
            
          </td>
        </tr></table>
      
      
      
    </div>
    <div id="mainSection">
      
        
        
		<font color="DarkGray"> </font> <p /> <p />
	
        <div id="introductionSection" class="section">
    <p>The Microsoft SQL Server JDBC Driver can be used to work with data in a SQL Server database in a variety of ways. The JDBC driver can be used to run SQL statements against the database, or it can be used to call stored procedures in the database, using both input and output parameters. The JDBC driver also supports using SQL escape sequences, update counts, automatically generated keys, and performing updates within a batch operation. </p>
    <p>The JDBC driver provides three classes for retrieving data from a SQL Server database:</p>
    <ol><li>
        
          <a href="ec24963c-8b51-4838-91e9-1fbfa2347451.htm">SQLServerStatement</a> - used for running SQL statements without parameters.<br />
      </li><li>
        
          <a href="a8481c06-fbba-432b-8c69-4f4619c20ad4.htm">SQLServerPreparedStatement</a> - (inherited from <b>SQLServerStatement</b>), used for running compiled SQL statements that might contain IN parameters.<br />
      </li><li>
        
          <a href="30710a63-c05d-47d9-9cf9-c087a1c76373.htm">SQLServerCallableStatement</a> - (inherited from <b>SQLServerPreparedStatement</b>), used for running stored procedures that might contain IN parameters, OUT parameters, or both.<br />
      </li></ol>
    <p>The topics in this section discuss how you can use each of the three statement classes to work with data in a SQL Server database.</p>
  </div><h1 class="heading">In This Section</h1><div id="inThisSectionSection" class="section">
    <content xmlns="http://ddue.schemas.microsoft.com/authoring/2003/5">
      <table width="100%" cellspacing="0" cellpadding="0" border="1" style="background-color: #CCCCCC;" xmlns=""><tr>
            <th>
              Topic
            </th>
            <th>
              Description
            </th>
          </tr><tr>
          <td>
            <p>
              <a href="fe28f48a-e1bc-48ff-a5e7-c24cd6e5ecc7.htm">Using Statements with SQL</a>
            </p>
          </td>
          <td>
            <p>Describes how to use SQL statements with the JDBC driver to work with data in a SQL Server database.</p>
          </td>
        </tr><tr>
          <td>
            <p>
              <a href="0041f9e1-09b6-4487-b052-afd636c8e89a.htm">Using Statements with Stored Procedures</a>
            </p>
          </td>
          <td>
            <p>Describes how to use stored procedures with the JDBC driver to work with data in a SQL Server database.</p>
          </td>
        </tr><tr>
          <td>
            <p>
              <a href="ab6a3cfa-073b-44e9-afca-a8675cfe5fd1.htm">Using Multiple Result Sets</a>
            </p>
          </td>
          <td>
            <p>Describes how to use the JDBC driver to retrieve data from multiple result sets.</p>
          </td>
        </tr><tr>
          <td>
            <p>
              <a href="00f9e25a-088e-4ac6-aa75-43eacace8f03.htm">Using SQL Escape Sequences</a>
            </p>
          </td>
          <td>
            <p>Describes how to use SQL escape sequences, such as date and time literals and functions.</p>
          </td>
        </tr><tr>
          <td>
            <p>
              <a href="55a062c7-45ce-40e3-9a6f-4a0f4da4e2a6.htm">Using Auto Generated Keys</a>
            </p>
          </td>
          <td>
            <p>Describes how to use automatically generated keys.</p>
          </td>
        </tr><tr>
          <td>
            <p>
              <a href="1a576d95-7da6-4b7b-8b32-59e5b4d354c4.htm">Performing Batch Operations</a>
            </p>
          </td>
          <td>
            <p>Describes how to use the JDBC driver to perform batch operations.</p>
          </td>
        </tr><tr>
          <td>
            <p>
              <a href="6b807a45-a8b5-4b1c-8b7b-d8175c710ce0.htm">Handling Complex Statements</a>
            </p>
          </td>
          <td>
            <p>Describes how to use the JDBC driver to run complex statements that perform a variety of tasks and might return different types of data.</p>
          </td>
        </tr></table>
    </content>
  </div><span id="seeAlsoSpan"><h1 class="heading">See Also</h1></span><div id="seeAlsoSection" class="section" name="collapseableSection"><a href="939a8773-2583-49a4-bf00-6b892fbe39dc.htm">Overview of the JDBC Driver</a><br /><br /></div><!--[if gte IE 5]>
			<tool:tip element="seeAlsoToolTip" avoidmouse="false"/><tool:tip element="languageFilterToolTip" avoidmouse="false"/><tool:tip element="roleInfoSpan" avoidmouse="false"/>
		<![endif]-->
      <div id="footer" class="section">
        
		<hr />
		
		<span id="fb" class="feedbackcss">
			
			
		</span>
		
		<a href="9bad553b-9e70-4696-8499-2e35f772a1e0.htm">
			
			© 2009 Microsoft Corporation. All rights reserved.
		</a>
 	
	
      </div>
    </div>
  </body>
</html>